<template>
	<view :class="[{ white: !colorStyle, black: colorStyle }, lang]">
		<u-navbar :is-fixed="true" v-bind:title="timelang + countdown" back-icon-name="arrow-left"
			:background="background" v-bind:title-color="titlecolor" :back-icon-color="titlecolor"
			:custom-back="qiutexam">
			<view class="slot-wrap">
				<view class="navbar-right">
					<view class="message-box right-item" @click="settings()">
						<image class="settingimg"
							v-bind:src="colorStyle == true ? '../../static/icon/settinga.png' : '../../static/icon/setting.png'">
						</image>
					</view>
				</view>
			</view>
		</u-navbar>

		<view class="mheight" @touchmove="handletouchmove" @touchstart="handletouchstart" @touchend="handletouchend">
			<view class="topic" :class="jin == true ? classz + ' ' + lang + 'layout' : lang + 'layout'">
				<view class="topiccon" v-bind:style="{ fontSize: fontSize + 'rpx' }">
					<view class="topictype"
						v-bind:style="{ height: fontSize + 10 + 'rpx', lineHeight: fontSize + langheight - 16 + 'rpx' }">
						{{subarr.ttype}}
						<text class="whitetxt" v-if="subarr.ttype == 0">{{ $t('keeping.判断题') }}</text>
						<text class="whitetxt" v-if="subarr.ttype == 1">{{ $t('keeping.单选题') }}</text>
						<text class="whitetxt" v-if="subarr.ttype == 2">{{ $t('keeping.多选题') }}</text>
					</view>
					<view class="toppicplay"
						v-bind:style="{ width: fontSize + 10 + 'rpx', height: fontSize + 10 + 'rpx' }">
						<image :style="{ width: fontSize + 10 + 'rpx', height: fontSize + 10 + 'rpx' }"
							src="../../static/icon/play.png"></image>
					</view>
					<!-- <view class="topictext"> -->

					<text class="pl-20 txtalign vtlineheight" :class="lang + 'margint'"
						style="text-align: justify; line-height: 200%;">
						{{ viewsindex + 1 }}.{{ subarr.question == undefined ? '' : subarr.question }}
						<i class="viewid">{{ subarr.tid }}</i>
					</text>
					<view class="timg"  v-if="item.timg !== '' && item.timg != null">
						<image :src="tiimg" mode="aspectFit" @error="onimgerr()"></image>
					</view>
					<!-- </view> -->
					<view class="clearfloat"></view>
					<view class="answer">
						<view v-if="subarr.ttype == 1">
							<view class="answers" :class="jawap[0]" @click="chack('A')">
								<view class="answerselect">
									<view class="answerabcd"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap != 'A' && jawap[0] == ''">A</text>
										<text v-if="dbjawap == 'A' && jawap[0] == 'anschack 1'">A</text>
										<u-icon v-if="dbjawap == 'A' && jawap[0] == 'anschack'" name="checkmark">
										</u-icon>
										<u-icon v-if="jawap[0] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option1 }}</text>
								</view>
							</view>

							<view class="answers" :class="jawap[1]" @click="chack('B')">
								<view class="answerselect">
									<view class="answerabcd"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap != 'B' && jawap[1] == ''">B</text>
										<text v-if="dbjawap == 'B' && jawap[1] == 'anschack 1'">B</text>
										<u-icon v-if="dbjawap == 'B' && jawap[1] == 'anschack'" name="checkmark">
										</u-icon>
										<u-icon v-if="jawap[1] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option2 }}</text>
								</view>
							</view>
							<view class="answers" :class="jawap[2]" @click="chack('C')">
								<view class="answerselect">
									<view class="answerabcd"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap != 'C' && jawap[2] == ''">C</text>
										<text v-if="dbjawap == 'C' && jawap[2] == 'anschack 1'">C</text>
										<u-icon v-if="dbjawap == 'C' && jawap[2] == 'anschack'" name="checkmark">
										</u-icon>
										<u-icon v-if="jawap[2] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option3 }}</text>
								</view>
							</view>
							<view class="answers" v-if="subarr.option4 != ''" :class="jawap[3]" @click="chack('D')">
								<view class="answerselect">
									<view class="answerabcd"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap != 'D' && jawap[3] == ''">D</text>
										<text v-if="dbjawap == 'D' && jawap[3] == 'anschack 1'">D</text>
										<u-icon v-if="dbjawap == 'D' && jawap[3] == 'anschack'" name="checkmark">
										</u-icon>
										<u-icon v-if="jawap[3] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option4 }}</text>
								</view>
							</view>
						</view>

						<view v-if="subarr.ttype == 0">
							<view class="answers" :class="jawapjudge[0]" @click="chackjudge('对')">
								<view class="answerselect">
									<view class="answerabcd"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap != '对' && jawapjudge[0] == ''">A</text>
										<text v-if="dbjawap == '对' && jawapjudge[0] == 'anschack 1'">A</text>
										<u-icon v-if="dbjawap == '对' && jawapjudge[0] == 'anschack'" name="checkmark">
										</u-icon>
										<u-icon v-if="jawapjudge[0] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ $t('keeping.对') }}</text>
								</view>
							</view>
							<view class="answers" :class="jawapjudge[1]" @click="chackjudge('错')">
								<view class="answerselect">
									<view class="answerabcd"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap != '错' && jawapjudge[1] == ''">B</text>
										<text v-if="dbjawap == '错' && jawapjudge[1] == 'anschack 1'">B</text>
										<u-icon v-if="dbjawap == '错' && jawapjudge[1] == 'anschack'" name="checkmark">
										</u-icon>
										<u-icon v-if="jawapjudge[1] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ $t('keeping.错') }}</text>
								</view>
							</view>
						</view>

						<view v-if="subarr.ttype == 2">
							<view class="answers" :class="jawap[0]" @click="chackduo('A')">
								<view class="answerselect">
									<view class="answerabcd" :class="answers.indexOf('A') !== -1 ? 'abdborder' : ''"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap.indexOf('A') === -1 && jawap[0] == ''">A</text>
										<text v-if="dbjawap.indexOf('A') !== -1 && jawap[0] == 'anschack 1'">A</text>
										<u-icon v-if="dbjawap.indexOf('A') !== -1 && jawap[0] == 'anschack'"
											name="checkmark"></u-icon>
										<u-icon v-if="jawap[0] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option1 }}</text>
								</view>
							</view>

							<view class="answers" :class="jawap[1]" @click="chackduo('B')">
								<view class="answerselect">
									<view class="answerabcd" :class="answers.indexOf('B') !== -1 ? 'abdborder' : ''"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap.indexOf('B') === -1 && jawap[1] == ''">B</text>
										<text v-if="dbjawap.indexOf('B') !== -1 && jawap[1] == 'anschack 1'">B</text>
										<u-icon v-if="dbjawap.indexOf('B') !== -1 && jawap[1] == 'anschack'"
											name="checkmark"></u-icon>
										<u-icon v-if="jawap[1] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option2 }}</text>
								</view>
							</view>
							<view class="answers" :class="jawap[2]" @click="chackduo('C')">
								<view class="answerselect">
									<view class="answerabcd" :class="answers.indexOf('C') !== -1 ? 'abdborder' : ''"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap.indexOf('C') === -1 && jawap[2] == ''">C</text>
										<text v-if="dbjawap.indexOf('C') !== -1 && jawap[2] == 'anschack 1'">C</text>
										<u-icon v-if="dbjawap.indexOf('C') !== -1 && jawap[2] == 'anschack'"
											name="checkmark"></u-icon>
										<u-icon v-if="jawap[2] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option3 }}</text>
								</view>
							</view>
							<view class="answers" v-if="subarr.option4 != ''" :class="jawap[3]" @click="chackduo('D')">
								<view class="answerselect">
									<view class="answerabcd" :class="answers.indexOf('D') !== -1 ? 'abdborder' : ''"
										v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: fontSize + langheight + 'rpx' }">
										<text v-if="dbjawap.indexOf('D') === -1 && jawap[3] == ''">D</text>
										<text v-if="dbjawap.indexOf('D') !== -1 && jawap[3] == 'anschack 1'">D</text>
										<u-icon v-if="dbjawap.indexOf('D') == -1 && jawap[3] == 'anschack'"
											name="checkmark"></u-icon>
										<u-icon v-if="jawap[3] == 'wrong'" name="close"></u-icon>
									</view>
								</view>
								<view class="answerstext">
									<text>{{ subarr.option4 }}</text>
								</view>
							</view>
							<view class="queding" v-if="subarrid[viewsindex].userjawap == null">
								<button class="duoqueding" @click="duoque()">{{ $t('keeping.确定') }}</button>
							</view>
						</view>
						<view class="bos100"></view>
					</view>
					<view class="clearfloat"></view>
					<view class="answercol" v-if="dbjawap">
						<view class="answerow">{{ $t('parctices.答案') }}
							{{ subarr.ttype == 0 ? $t('keeping.' + dbjawap) : dbjawap }}
						</view>
						<view class="answerclear csimg" @click="collects()">
							<image class="colles" mode="widthFix"
								:src="star == 1 ? '../../static/icon/starfull.png' : '../../static/icon/star.png'">
							</image>
							<!-- <u-icon :class="subarr.collect == 1?'grenntext':''" top="1" :name="star" -->
							<!-- :style="star=='star-fill'?'color:yellow':''" size="35"></u-icon> -->
						</view>
						<view class="answerow" @click="feed()">{{ $t('parctices.纠错') }}</view>
					</view>
					<view class="answermark" v-if="dbjawap">
						<view class="answermarktitle bluemark">{{ $t('parctices.解释') }}</view>

						<rich-text class="nodeheight" style="text-align: justify; line-height: 200%;"
							:nodes="subarr.chapter"></rich-text>
						<rich-text style="text-align: justify;" :nodes="subarr.tdesc"></rich-text>
						<!-- <view class="answermarktitle pinkmark">{{ $t('parctices.技巧') }}</view>
					<view class="answermarkcon">
						<view class="answermarkcon">{{ subarr.explain }}</view>
					</view> -->
					</view>
				</view>
			</view>
			<view class="marfoot">
				<view class="markfoot">
					<view class="markfootview pl-15" @click="privet(1)">
						<u-icon name="arrow-left"></u-icon>
						<text>{{ $t('parctices.上一题') }}</text>
					</view>
					<view class="markfootview grenn" @click="datika()">
						<u-icon top="1" name="checkmark-circle-fill" color="#00B800" size="35"></u-icon>
						<text class="pl-10">{{ twracount }}</text>
					</view>
					<view class="markfootview" @click="jiaojuant()">
						<view class="kongan">{{ $t('parctices.交卷') }}</view>
					</view>
					<view class="markfootview error" @click="datika()">
						<u-icon top="1" name="close-circle-fill" color="#E70F43" size="35"></u-icon>
						<text class="pl-10">{{ hatecount }}</text>
					</view>
					<view class="markfootview pr-15" @click="nextt(1)">
						<text>{{ $t('parctices.下一题') }}</text>
						<u-icon name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
			<view class="clearfloat"></view>
		</view>
		<u-popup v-model="showcart" class="popup" mode="bottom" height="700rpx">
			<view>
				<view class="carttitle">
					<view class="carttitleview">
						<text>{{ $t('parctices.答题卡') }}</text>
					</view>
					<view class="carttitleview">
						<view class="markfootview grenn">
							<u-icon top="1" name="checkmark-circle-fill" color="#00B800" size="35"></u-icon>
							<text class="pl-10 grenntext">{{ twracount }}</text>
						</view>
						<view class="markfootview pl-20"></view>
						<view class="markfootview error">
							<u-icon top="1" name="close-circle-fill" color="#E70F43" size="35"></u-icon>
							<text class="pl-10 redtext">{{ hatecount }}</text>
						</view>
					</view>
					<view class="carttitleview">
						<text>{{ twracount + hatecount }}/{{ datacount }}</text>
					</view>
				</view>
				<view class="cartcon">
					<view class="scroll-Y">
						<scroll-view scroll-y="true" show-scrollbar="true" class="cartconview">
							<block v-for="(item, index) in subarrid" :key="index">
								<view class="cartconnum cartblue" v-if="item.twrahate == 1" @click="tiao(index)">
									{{ index + 1 }}
								</view>
								<view class="cartconnum cartpink" v-if="item.twrahate == 0" @click="tiao(index)">
									{{ index + 1 }}
								</view>
								<view class="cartconnum" v-if="item.twrahate == 2"
									:class="index == viewsindex ? 'cartaction' : ' '" @click="tiao(index)">
									{{ index + 1 }}
								</view>
							</block>

						</scroll-view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup v-model="show" class="popup" border-radius="15" mode="bottom" length="40%" :closeable="closeable"
			:close-icon-pos="closeIconPos">
			<view>
				<view class="poptitle">
					<view class="settingtitle font-35">
						<text>{{ $t('parctices.设置') }}</text>
					</view>
				</view>
				<view class="settingcon pt50" :class="lang + 'layout'">
					<view class="settingcontxt">{{ $t('parctices.答题音效提示') }}</view>
					<view class="settingswith">
						<u-switch active-color="#07BB07" @change="musicbar" size="40" v-model="musicchecked"></u-switch>
					</view>
				</view>
				<view class="settingcon p-t20" :class="lang + 'layout'">
					<view class="settingcontxt">{{ $t('parctices.答题震动提示') }}</view>
					<view class="settingswith">
						<u-switch active-color="#07BB07" @change="vibrate" size="40" v-model="zhenchecked"></u-switch>
					</view>
				</view>
				<view class="settingcon p-t20" :class="lang + 'layout'">
					<view class="settingcontxt">{{ $t('parctices.答对自动下一题') }}</view>
					<view class="settingswith">
						<u-switch active-color="#07BB07" @change="marknext" size="40" v-model="nextchecked"></u-switch>
					</view>
				</view>
				<view class="fontsizes">
					<view class="fontsizeleft font-18">A</view>
					<view class="fontsizebg">
						<slider class="fontslider" min="30" max="40" v-bind:value="fontSize" @change="sliderChange"
							activeColor="#C6C7C6" backgroundColor="#C6C7C6" block-size="20" />
					</view>
					<view class="fontsizeleft font-35">A</view>
				</view>
				<view class="settingfoot">
					<view class="settingfoottext">{{ $t('parctices.模式') }}</view>
					<button class="settingfootbu black font-25" @click="colour(0)">
						<view class="settingfootbutext">{{ $t('parctices.夜间模式') }}</view>
						<image src="../../static/icon/atnight.png"></image>
					</button>
					<button class="settingfootbu white font-25" @click="colour(1)">
						<text>{{ $t('parctices.白天模式') }}</text>
						<image src="../../static/icon/day.png"></image>
					</button>
				</view>
			</view>
		</u-popup>
		<u-popup v-model="shownum" :mask-close-able="false" class="popup" border-radius="30" mode="center"
			height="800rpx">
			<view class="flunk">
				<view class="flunktitle font-45 redtext">
					<text v-if="hegetrue == true">{{ $t('keeping.成绩合格') }}</text>
					<text v-if="hegetrue == false">{{ $t('parctices.成绩不合格') }}</text>
				</view>
				<view class="flunkcon redborder">
					<view class="flunkconview">
						<view class="flunkconviewtext font-35">
							<text>{{ $t('parctices.当前考试进度') }}</text>
						</view>
						<view class="flunkconviewtext font-35">
							<text>{{ twracount + hatecount }}/{{ subarrid.length }}</text>
						</view>
					</view>
				</view>
				<view class="flunkview">
					<view class="flunkviewrow">
						<view class="flunkviewrowtxt grenntext">{{ jalpenum }}</view>
						<view class="flunkviewrowtxt grenntext">
							<text>{{ $t('parctices.已答题数') }}</text>
						</view>
					</view>
					<view class="flunkviewrow">
						<view class="flunkviewrowtxt">{{ hatecount }}</view>
						<view class="flunkviewrowtxt">
							<text>{{ $t('parctices.答错题数') }}</text>
						</view>
					</view>
					<view class="flunkviewrow">
						<view class="flunkviewrowtxt redtext">{{ subarrid.length - (twracount + hatecount) }}</view>
						<view class="flunkviewrowtxt redtext">
							<text>{{ $t('parctices.未做题数') }}</text>
						</view>
					</view>
				</view>
				<view class="flunkfoot">
					<view class="flunkfootbutton greybg grenntext" @click="jixu()"
						:class="lang == 'cn' ? 'font-30' : 'font-30'">
						<text>{{ $t('parctices.继续做题') }}</text>
					</view>
					<view class="flunkfootbutton greenbg whitetxt font-30" @click="jiaojuan()">
						<text>{{ $t('parctices.交卷') }}</text>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup v-model="showqiut" :mask-close-able="false" class="popup" border-radius="30" mode="center"
			height="700rpx">
			<view class="flunkq">
				<view class="flunktitle font-45 redtext">{{ $t('parctices.退出做题') }}</view>
				<view class="flunkcon greyborder">
					<view class="flunkconview">
						<view class="flunkconviewtext font-35">
							<text>{{ $t('parctices.当前考试进度') }}</text>
						</view>
						<view class="flunkconviewtext font-35">
							<text>{{ twracount + hatecount }}/{{ subarrid.length }}</text>
						</view>
					</view>
				</view>

				<view class="flunkfoot">
					<view class="flunkfootbutton greybg grenntext" @click="jixu()"
						:class="lang == 'cn' ? 'font-45' : 'font-30'">
						<text>{{ $t('parctices.继续做题') }}</text>
					</view>
					<view class="flunkfootbutton greenbg whitetxt" @click="jiaojuan()"
						:class="lang == 'cn' ? 'font-45' : 'font-30'">
						<text>{{ $t('parctices.交卷') }}</text>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	//#ifdef APP-PLUS
	import {
		isOpen,
		openDb,
		addTab,
		mergeSql,
		getDataList,
		addTabItem,
		closeSQL,
		deleteInformationType,
		getTable,
		getCount,
		updateSQL,
		isTable,
		selectDataList
	} from '@/js_sdk/lyz-sqlite/index.js';
	import {
		getFileName,
		getimgname
	} from '../../common/imgtool.js';
	//#endif
	import {
		getCarType,
		getArrEqual,
		getArrload
	} from '../../common/savetool.js';

	//接口
	import {
		monei_api, //题库顺序联系
		cuotilist_api, //错题收藏列表id
		upurl,
		yunurl,
		shoucang_api //收藏
	} from '@/api/index';
	var maxtime = 10 * 60;
	const inAudioContext = uni.createInnerAudioContext();
	export default {
		data() {
			return {
				lang: this.$i18n.locale,
				//左右滑动监听
				flag: 0, //1向左滑动,2向右滑动,3向上滑动 4向下滑动
				lastX: 0,
				lastXX: 0,
				//答题卡滚动
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
				rightSlot: true,
				fontSize: 33,
				//设置弹出框
				show: false,
				closeable: true,
				closeIconPos: 'top-right',
				//背景音乐
				musicchecked: true,
				zhenchecked: false, //是否打开震动
				nextchecked: true, //自动跳转下一题
				colorStyle: false, //true:夜间模式，false:日间
				// background: '#ffffff',
				background: {
					backgroundColor: '#ffffff'
				},
				titlecolor: '#ffffff',
				showcart: false, //答题卡弹出框
				wahte: 0,
				m: 45, //分
				s: 0, //秒
				countdown: '', //倒计时

				timer: null, //重复执行
				timelang: this.$t('parctices.时间'),

				shownum: false, //不合格
				showqiut: false, //退出
				langheight: 20,
				//获取数据库数量
				datacount: 0,
				subject: 'C1C2C3', //科目
				subarrid: [], //题id
				subarr: {},
				subarrs: [],
				viewsindex: 0, //已经看完的题
				kemu: 1,
				lolang: 'CN',
				jsonplus: false,
				storageindex: -1, //存储引导id
				storagearr: [],
				star: 0,
				jawap: ['', '', '', ''],
				jawapjudge: ['', ''],
				dbjawap: '',
				worngly: false,
				answers: [], //选择的多选题
				twracount: 0,
				hatecount: 0,
				tiimg: '',
				dannumber: 0, //单个单选题题得分
				duonumber: 0, //单个多选题题得分
				pannumber: 0, //单个判断题得分
				jalpenum: 0, //全部得分
				hege: 0, //考试合格最低分
				hegetrue: false, //显示成绩合格还是不合格
				timeout: false, //时间还没到  时间到改成true
				cartype: '', //车型
				jin: false, //动画特效开光
				classz: 'tanchu', //动画样式
				zzlx: 0
			};
		},
		onInit() {
			var that = this;
			//获取全局题id
		},
		onReady() {},

		onBackPress(opt) {
			console.log("opt", opt)
			console.log('点击返回键：onBackPress');
			var that = this;
			that.showqiut = true;
			clearInterval(this.timer);


			console.log('点击返回键：onBackPress');
			if (options.from === 'navigateBack') {
				return false;
			}

			return false;
			// var that = this;
			// that.showqiut = true;
			// return false;
		},

		onUnload() {
			console.log('点击返回键：onUnload()');
			var that = this;
			that.showqiut = true;
			clearInterval(this.timer);
			return true;
		},
		onLoad(options) {
			var that = this;
			var kemu = options.kemu;
			if (kemu == undefined) {
				uni.reLaunch({
					url: '../index/start'
				});
				return;
			}
			that.kemu = kemu;

			var langstr = uni.getStorageSync('lang_key');
			that.$i18n.locale = langstr;
			that.lang = langstr;
			if (langstr == 'cn') {
				that.lolang = 'CN';
			}
			if (langstr == 'uy') {
				that.lolang = 'UG';
			}
			if (langstr == 'kz') {
				that.lolang = 'KAZ';
			}
			if (langstr == 'cn') {
				that.langheight = 20;
			} else {
				that.langheight = 38;
			}
			console.log('lang', that.$i18n.locale);

			// 题库年份
			uni.getStorage({
				key: 'year_key',
				success: function(res) {
					console.log("年份", res.data)
					if (res.data == "2022") {
						that.yearIndex = 0
						that.year = "2022"
					} else {
						that.yearIndex = 1
						that.year = "2023"
					}
				},
				fail() {
					that.$u.route({
						url: 'pages/setting/setting',
						params: {}
					});
				}
			});


			uni.getStorage({
				key: 'cart_type',
				success: function(res) {
					console.log(res, '=====');
					console.log(res.data);
					console.log('getCarType--=', getCarType(res.data));
					that.cartype = res.data;
					that.subject = getCarType(res.data);
					//#ifdef APP-PLUS
					if (isOpen('data')) {
						//数据库已打开
						console.log('数据库已打开');
						that.dbid(kemu);
					} else {
						//数据库没有打开  先打开
						console.log('数据库未打开');
						that.openDb();
					}
					//#endif
					// #ifdef MP-WEIXIN
					that.minidbid(kemu);
					//#endif
				}
			});

			//演示
			if (options.shownum == 'true') {
				that.shownum = true;
			}
			if (options.showqiut == 'true') {
				that.showqiut = true;
			}
			//演示
			if (that.colorStyle == true) {
				that.background.backgroundColor = '#2d2d2d';
				that.titlecolor = '#888888';
			} else {
				that.background.backgroundColor = '#ffffff';
				that.titlecolor = '#2d2d2d';
			}

			//先查找字体保存情况  如果有存储 直接使用
			uni.getStorage({
				key: 'fontsize',
				success: function(res) {
					//console.log(res.data);
					that.fontSize = res.data;
				}
			});
			uni.getStorage({
				key: 'musicbars',
				success: function(res) {
					//console.log(res.data);
					that.musicchecked = res.data;
				}
			});
			uni.getStorage({
				key: 'vibratebars',
				success: function(res) {
					that.zhenchecked = res.data;
				}
			});
			uni.getStorage({
				key: 'nextbars',
				success: function(res) {
					that.nextchecked = res.data;
				}
			});
			uni.getStorage({
				key: 'colorStyle',
				success: function(res) {
					that.colorStyle = res.data;
					that.titlebgcolor(res.data);
				}
			});
			uni.getStorage({
				key: 'exam_type',
				success: function(res) {
					var types = res.data;
					if (types == 'jiashizheng') {
						that.zzlx = 0;
					} else {
						that.zzlx = 1;
					}
				},
				fail() {}
			});
			//倒计时开始
			that.timerstart();
		},
		methods: {
			feed() {
				var that = this;
				//链接到意见反馈页面
				var feedtype = 1;
				var dbid = that.subarr.tid;
				uni.navigateTo({
					url: '../feedback/feedback?fankuitype=' + feedtype + '&tid=' + dbid
				});
			},
			timerstart() {
				this.timer = setInterval(() => {
					this.timeCount();
				}, 1000);
			},
			qiutexam() {
				var that = this;
				that.showqiut = true;
				clearInterval(this.timer);
				return false;
			},
			onBackPress(event) {
				console.log(event);
				this.showqiut = true;
				clearInterval(this.timer);
				// uni.switchTab({
				// 	url: "../index/index"
				// })
				// 此处一定要return为true，否则页面不会返回到指定路径
				return true;
			},

			//答题卡
			datika() {
				var that = this;
				that.showcart = true;
			},
			//答题卡滚动
			scroll: function(e) {
				this.old.scrollTop = e.detail.scrollTop;
			},
			goTop: function(e) {
				this.scrollTop = this.old.scrollTop;
				this.$nextTick(function() {
					this.scrollTop = 0;
				});
			},
			//单选题
			chack(jawap) {
				var that = this;
				console.log('jawap:', jawap);
				console.log("dbjawap=", that.dbjawap);
				var ind = that.viewsindex;
				if (that.subarrid[ind].wancheng) {
					console.log('已经选择过了  不能再选择');
				} else {
					if (that.subarr.answer == jawap) {
						//答案正确 ,
						if (jawap == 'A') {
							that.jawap[0] = 'anschack';
						} else if (jawap == 'B') {
							that.jawap[1] = 'anschack';
						} else if (jawap == 'C') {
							that.jawap[2] = 'anschack';
						} else {
							that.jawap[3] = 'anschack';
						}
						that.sska(1, 2);
						if (that.nextchecked) {
							setTimeout(function() {
								that.nextt();
							}, 50)
						}
					} else {
						//打错了！
						if (jawap == 'A') {
							that.jawap[0] = 'wrong';
						} else if (jawap == 'B') {
							that.jawap[1] = 'wrong';
						} else if (jawap == 'C') {
							that.jawap[2] = 'wrong';
						} else {
							that.jawap[3] = 'wrong';
						}
						that.sska(0, 2);
						//正确答案是
						if (that.subarr.answer == 'A') {
							that.jawap[0] = 'anschack 1';
						} else if (that.subarr.answer == 'B') {
							that.jawap[1] = 'anschack 1';
						} else if (that.subarr.answer == 'C') {
							that.jawap[2] = 'anschack 1';
						} else {
							that.jawap[3] = 'anschack 1';
						}

						//that.jawap = 'wrong';
						//进行收藏
					}
					//存储答案
					//console.log("star id=",id);

					that.subarrid[ind].wancheng = true;
					that.subarrid[ind].userjawap = jawap;
					// console.log(that.subarrid[ind]);
					// console.log(that.subarrid);

				}

				//查看是否打开自动开关，进入到下一题

				//显示正确答案
				that.dbjawap = that.subarr.answer;
				that.worngly = true;
			},
			//判断题
			chackjudge(jawap) {
				var that = this;
				console.log('jawap:', jawap);
				var ind = that.viewsindex;
				if (that.subarrid[ind].wancheng) {
					console.log('已经选择过了  不能再选择');
				} else {
					that.subarrid[ind].wancheng = true;
					that.subarrid[ind].userjawap = jawap;
					if (that.subarr.answer == jawap) {
						//答案正确 ,
						if (jawap == '对') {
							that.jawapjudge[0] = 'anschack';
						} else {
							that.jawapjudge[1] = 'anschack';
						}
						that.sska(1, 1);
						if (that.nextchecked) {
							setTimeout(function() {
								that.dbjawap = '';
								that.nextt();
							}, 50)
						}
					} else {
						//打错了！
						if (jawap == '对') {
							that.jawapjudge[0] = 'wrong';
						} else {
							that.jawapjudge[1] = 'wrong';
						}
						//正确答案是
						if (that.subarr.answer == '对') {
							that.jawapjudge[0] = 'anschack 1';
						} else {
							that.jawapjudge[1] = 'anschack 1';
						}

						that.sska(0, 1);
						//that.jawap = 'wrong';
						//进行收藏
					}
					//存储答案
					//console.log("star id=",id);
				}

				// console.log(that.subarrid[ind]);
				// console.log(that.subarrid);
				//查看是否打开自动开关，进入到下一题

				//显示正确答案
				that.dbjawap = that.subarr.answer;
				that.worngly = true;
			},
			//多选题
			chackduo(jawaptar) {
				var that = this;
				var ind = that.viewsindex;
				if (that.subarrid[ind].wancheng) {
					console.log('已经选择过了  不能再选择');
				} else {
					var j = that.answers;
					var text = jawaptar;
					var ind = j.indexOf(text);
					if (ind === -1) {
						that.answers.push(text);
					} else {
						that.answers.splice(ind, 1);
					}
				}

				// that.answers = j;
				console.log('jawaptar', that.answers);
			},
			duoque() {
				var that = this;
				console.log("***********************************************")
				console.log(that.subarr);
				console.log("that.answers.length", that.answers.length);

				if (that.answers.length < 2) {
					return false;
				}
				var dbid = that.subarr.tid;

				var jawaptar = that.answers.sort();
				console.log(dbid);
				console.log('dbid', dbid);
				var dbjawaptar = jawaptar.toString();
				//var jawapstr = jawaptar
				var ind = that.viewsindex;
				that.subarrid[ind].userjawap = dbjawaptar;
				that.subarrid[ind].wancheng = true;

				//页面上展示正确答案
				//判断错误答案
				let sane = 3;
				var twrajawap = that.subarr.answer;
				that.dbjawap = twrajawap;
				if (that.subarr.option4 == '') {
					sane = 2;
				}
				var jawapjson = twrajawap.split('');
				if (jawapjson.indexOf('A') !== -1) {
					that.jawap[0] = 'anschack 1';
				}
				if (jawapjson.indexOf('B') !== -1) {
					that.jawap[1] = 'anschack 1';
				}
				if (jawapjson.indexOf('C') !== -1) {
					that.jawap[2] = 'anschack 1';
				}
				if (sane == 3) {
					if (jawapjson.indexOf('D') !== -1) {
						that.jawap[3] = 'anschack 1';
					}
				}
				console.log('json = ', jawapjson);

				let arrload = getArrload(jawapjson, jawaptar);
				console.log('=======', arrload);
				let ashane = getArrEqual(jawapjson, jawaptar);
				if (arrload.length == 0) {
					console.log('全部正确');
					that.sska(1, 3);
					if (that.nextchecked) {
						that.answers = [];

						setTimeout(function() {
							that.nextt();
						}, 50)
					}
				} else {
					console.log('部分正确');
					that.sska(0, 3);
					for (var i = 0; i < sane; i++) {
						if (jawapjson[i] == jawaptar[i]) {
							that.jawap[i] = 'anschack 1';
						} else {
							that.jawap[i] = 'wrong';
						}
					}
					for (var t = 0; t < jawaptar.length; t++) {
						if (jawapjson.indexOf(jawaptar[t]) == -1) {
							if (jawaptar[t] == 'A') {
								that.jawap[0] = 'wrong';
							}
							if (jawaptar[t] == 'B') {
								that.jawap[1] = 'wrong';
							}
							if (jawaptar[t] == 'C') {
								that.jawap[2] = 'wrong';
							}
							if (jawaptar[t] == 'D') {
								that.jawap[3] = 'wrong';
							}
						}
					}
				}

				//选择正确的
				if (ashane.indexOf('A') !== -1) {
					that.jawap[0] = 'anschack';
				}
				if (ashane.indexOf('B') !== -1) {
					that.jawap[1] = 'anschack';
				}
				if (ashane.indexOf('C') !== -1) {
					that.jawap[2] = 'anschack';
				}
				if (sane == 3) {
					if (ashane.indexOf('D') !== -1) {
						that.jawap[3] = 'anschack';
					}
				}
				//没有选择的
				if (arrload.indexOf('A') !== -1) {
					that.jawap[0] = 'anschack 1';
				}
				if (arrload.indexOf('B') !== -1) {
					that.jawap[1] = 'anschack 1';
				}
				if (arrload.indexOf('C') !== -1) {
					that.jawap[2] = 'anschack 1';
				}
				if (sane == 3) {
					if (arrload.indexOf('D') !== -1) {
						that.jawap[3] = 'anschack 1';
					}
				}
			},
			async sska(num, pn) {
				var that = this;
				if (num == 1) {
					//数据中添加一个正确总数
					that.twracount = that.twracount + 1;
					//答题卡中表示正确
					that.subarrid[that.viewsindex].twrahate = 1;
					//计算总分
					if (pn == 1) {
						that.jalpenum = that.jalpenum + that.pannumber;
					}
					if (pn == 2) {
						that.jalpenum = that.jalpenum + that.dannumber;
					}
					if (pn == 3) {
						that.jalpenum = that.jalpenum + that.duonumber;
					}
					//播放音效   正确  先判断是否允许播放
					//inAudioContext.stop();
					if (that.musicchecked) {
						console.log('播放声音 正确');
						//inAudioContext.autoplay = true;
						const innerAudioContextcuress = uni.createInnerAudioContext();
						//inAudioContext.autoplay = true;
						innerAudioContextcuress.src = '/static/media/cuss.mp3';
						innerAudioContextcuress.autoplay = true;
						// inAudioContext.src = 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3';
						innerAudioContextcuress.play();
						innerAudioContextcuress.onPlay(() => {
							console.log('开始播放');
						});
						innerAudioContextcuress.onError(res => {
							console.log(res.errMsg);
							console.log(res.errCode);
						});
						innerAudioContextcuress.onEnded(() => {
							console.log('正确声音播放完成');
							innerAudioContextcuress.destroy();
						});
					}
				} else {
					//数据中添加一个错误总数
					that.hatecount = that.hatecount + 1;
					//答题卡中表示错误
					that.subarrid[that.viewsindex].twrahate = 0;
					//播放音效  错误  先判断是否允许播放

					if (that.musicchecked) {
						console.log('播放声音 错误');
						const innerAudioContext = uni.createInnerAudioContext();
						innerAudioContext.autoplay = true;
						innerAudioContext.src = '/static/media/err.mp3';
						innerAudioContext.play();
						innerAudioContext.onPlay(() => {
							console.log('开始播放');
						});
						innerAudioContext.onError(res => {
							console.log(res.errMsg);
							console.log(res.errCode);
						});
						innerAudioContext.onEnded(() => {
							console.log('正确声音播放完成');
							innerAudioContext.destroy();
						});
					}
					//记录错题	//明天制作  complete
					uni.showLoading({
						title: '加载中...',
						mask: true
					});
					setTimeout(function() {
						that.cuoti();
					}, 200);
				}
			},
			collects() {
				//收藏
				var that = this;
				var dbid = that.subarrid[that.viewsindex].tid;
				console.log('dbid', dbid);
				if (that.star == 0) {
					// #ifdef APP-PLUS
					updateSQL(
						'data',
						'Tiku', {
							collect: 1
						},
						'tid',
						dbid
					).then(res => {
						console.log('1111, wancheng');
						that.star = 1;
					});
					// #endif
					// #ifdef MP-WEIXIN
					that.https({
						url: shoucang_api,
						method: 'POST',
						header: {
							'content-type': 'application/json'
						},
						data: {
							tid: dbid,
							type: 1, //0 表示取消收藏， 1加入收藏 -1收藏数减1
							daan: that.subarrid[that.viewsindex].userjawap,
							tlang: that.lolang,
							ktype: that.subject,
							zhengjianlx: that.zzlx, //资格证是 科目是0
							kemu: that.kemu,
							ttype: -1
						},
						success: res => {
							console.log(res);
							that.star = 1;
							//that.subarrid[that.viewsindex].complete = 1;
						},
						fail: err => {
							console.log(err);
							uni.showModal({
								title: '错误提示',
								content: err,
								success: function(res) {
									if (res.confirm) {
										console.log('用户点击确定');
									} else if (res.cancel) {
										console.log('用户点击取消');
									}
								}
							});
						}
					});
					// #endif
				} else {
					// #ifdef APP-PLUS
					updateSQL(
						'data',
						'Tiku', {
							collect: 0
						},
						'tid',
						dbid
					).then(res => {
						console.log('1111, wancheng');
						that.star = 0;
					});
					// #endif
					// #ifdef MP-WEIXIN
					that.https({
						url: shoucang_api,
						method: 'POST',
						header: {
							'content-type': 'application/json'
						},
						data: {
							tid: dbid,
							type: 0, //0 表示取消收藏， 1加入收藏 -1收藏数减1
							daan: that.subarrid[that.viewsindex].userjawap,
							tlang: that.lolang,
							ktype: that.subject,
							zhengjianlx: that.zzlx, //资格证是 科目是0
							kemu: that.kemu,
							ttype: -1
						},
						success: res => {
							console.log(res);
							that.star = 0;
							//that.subarrid[that.viewsindex].complete = 0;
						},
						fail: err => {
							console.log(err);
							uni.showModal({
								title: '错误提示',
								content: err,
								success: function(res) {
									if (res.confirm) {
										console.log('用户点击确定');
									} else if (res.cancel) {
										console.log('用户点击取消');
									}
								}
							});
						}
					});
					// #endif
				}
			},
			cuoti() {
				//记录错题
				var that = this;
				var dbid = that.subarrid[that.viewsindex].tid;
				console.log('dbid', dbid);
				// #ifdef APP-PLUS
				updateSQL(
					'data',
					'Tiku', {
						complete: 1,
						collect: 1
					},
					'tid',
					dbid
				).then(res => {
					console.log('1111, wancheng');
					that.star = 1;
				});
				// #endif
				// #ifdef MP-WEIXIN
				var bolxek = that.subarrid[that.viewsindex];
				console.log('jawap=', bolxek.userjawap);
				console.log('csjawap=', that.subarrid[that.viewsindex].userjawap, that.subarrid[that.viewsindex]);
				that.https({
					url: shoucang_api,
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {
						tid: dbid,
						type: 1, //0 表示取消收藏， 1加入收藏 -1收藏数减1
						daan: that.subarrid[that.viewsindex].userjawap, //userjawap
						tlang: that.lolang,
						ktype: that.subject,
						zhengjianlx: that.zzlx, //资格证是 科目是0
						kemu: that.kemu,
						ttype: -1
					},
					success: res => {
						console.log(res);
						that.star = 1;
						that.subarrid[that.viewsindex].complete = 1;
						that.subarrid[that.viewsindex].collect = 1;
					},
					fail: err => {
						console.log(err);
						uni.showModal({
							title: '错误提示',
							content: err,
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
					}
				});
				// #endif
				uni.hideLoading();
			},
			tiao(ind) {
				var that = this;
				console.log('ind ', ind);
				var dbid = that.subarrid[ind].tid;
				that.viewsindex = ind;
				that.tiimg = '';
				that.subarr = {};
				that.dbjawap = '';

				// #ifdef APP-PLUS
				that.subjectarr(dbid);
				// #endif
				// #ifdef MP-WEIXIN
				that.miniarr(ind);
				// #endif
				//that.viewsindex = ind;
			},

			backindex() {
				var that = this;
				console.log('进入跳转');
				if (that.kemu == 0) {
					uni.switchTab({
						url: '../index/qualification'
					});
				} else {
					uni.switchTab({
						url: '../index/index'
					});
				}
			},
			//打开数据库
			openDb() {
				var that = this;
				if (isOpen('data')) return;
				openDb('data').then(res => {
					console.log(res);
					that.dbid(that.kemu);
				});
			},
			dbcount() {
				var that = this;

				//that.dbid();
			},
			minidbid(indexdata) {
				var that = this;
				if(that.lolang =='CN'){
					that.year = "2023"
				}
				var exampleList = {
					duoxuan: [],
					danxuan: [],
					panduan: []
				};
				//var xart = " kemu=" + that.kemu + " and ktype='" + that.subject + "' and tlang = '" + that.lolang + "'";

				var dansane = 0; //单选题数量
				var pansane = 0; //判断题数量
				var duosane = 0; //多选题数量
				var hege = 0; //合格 多少分合格
				var shijian = 0; //考试时间
				var kzshijian = 0;
				var dannumber = 0; //单选题 一道题多少分
				var duonumber = 0; //多选题 一道题多少分
				var pannumber = 0; //判断题 一道题多少分
				//车类型来判断  cart_type
				if (that.subject == 'C1C2C3' || that.subject == 'A2B2' || that.subject == 'A1A3B1') {
					if (that.kemu == 1) {
						dansane = 60; //单选题数量
						pansane = 40; //判断题数量
						duosane = 0; //多选题数量
						shijian = 45;
						kzshijian = 60;
						dannumber = 1;
						duonumber = 1;
						pannumber = 1;
					} else if (that.kemu == 4) {
						dansane = 20; //单选题数量
						pansane = 20; //判断题数量
						duosane = 10; //多选题数量
						shijian = 45;
						kzshijian = 60;
						dannumber = 2;
						duonumber = 2;
						pannumber = 2;
					}
				} else if (that.subject == 'DEF') {
					dansane = 30; //单选题数量
					pansane = 20; //判断题数量
					duosane = 0; //多选题数量
					hege = 80;
					shijian = 45;
					kzshijian = 60;
					dannumber = 2;
					duonumber = 2;
					pannumber = 2;
				} else if (that.subject == 'Z_KEYUN') {
					dansane = 40; //单选题数量
					pansane = 40; //判断题数量
					duosane = 10; //多选题数量
					hege = 80;
					shijian = 60;
					kzshijian = 90;
					dannumber = 1;
					duonumber = 2;
					pannumber = 1;
				} else if (that.subject == 'Z_HUOYUN') {
					dansane = 20; //单选题数量
					pansane = 20; //判断题数量
					duosane = 30; //多选题数量
					hege = 80;
					shijian = 60;
					kzshijian = 90;
					dannumber = 1;
					duonumber = 2;
					pannumber = 1;
				} else if (that.subject == 'Z_WEIXIANPING') {
					dansane = 50; //单选题数量
					pansane = 50; //判断题数量
					duosane = 0; //多选题数量
					hege = 90;
					shijian = 90;
					kzshijian = 90;
					dannumber = 1;
					duonumber = 0;
					pannumber = 1;
				}

				var that = this;

				that.https({
					url: monei_api,
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {
						zzlx: that.zzlx,
						kemu: that.kemu,
						ktype: that.subject,
						danxuan_random_count: dansane,
						duoxuan_random_count: duosane,
						duicuo_random_count: pansane,
						lang: that.lolang
					},
					success: res => {
						console.log('res--------====', res);
						console.log(res.random_danxuan, res.random_duicuo, res.random_duoxuan);
						var data1 = res.random_danxuan;
						var data2 = res.random_duicuo;
						var data3 = res.random_duoxuan;
						var data4 = data2.concat(data1);
						var data = data4.concat(data3);

						console.log('data=', data);
						var est = data;

						for (var i = 0; i < est.length; i++) {
							est[i].userjawap = null;
							est[i].twrahate = 2;
							est[i].wancheng = false;
						}
						that.subarrid = est;
						that.datacount = est.length;
						console.log(est);
						//that.subjectarr(est[0].tid)
						//小程序自己的读取方式
						that.miniarr(0);

						uni.hideLoading();

						//记录
						that.hege = hege;
						//that.shijian = shijian;
						//that.countdown = shijian+":00"
						if (that.lang == 'cn') {
							that.m = shijian - 1;
							that.wahte = shijian;
						} else {
							that.m = kzshijian - 1;
							that.wahte = kzshijian;
						}

						that.dannumber = dannumber;
						that.duonumber = duonumber;
						that.pannumber = pannumber;
					},
					fail: err => {
						console.log(err);
						uni.showModal({
							title: '错误提示',
							content: err,
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
					}
				});

				// var dansql = "SELECT tid FROM Tiku WHERE ttype = 1  and " + xart + " order by random() limit " + dansane +
				// 	"";
				// var pansql = "SELECT tid FROM Tiku WHERE ttype = 0  and " + xart + " order by random() limit " + pansane +
				// 	"";
				// var duosql = "SELECT tid FROM Tiku WHERE ttype = 2  and " + xart + " order by random() limit " + duosane +
				// 	"";
				// var sql = "SELECT answer, tid  FROM Tiku  WHERE tid IN (" + dansql + ") or tid IN (" + pansql +
				// 	") or tid IN (" + duosql + ") order by ttype asc;";
				// // var danxuan = "";
				// // var panduan = "";
				// // var duoxuan = "";
				// plus.sqlite.selectSql({
				// 	name: 'data',
				// 	sql: sql,
				// 	success(est) {
				// 		console.log("sssssssssssssss", est.length);
				// 		console.log(sql);
				// 		for (var i = 0; i < est.length; i++) {
				// 			//console.log(i,est[i].tid);
				// 			est[i].userjawap = null;
				// 			est[i].twrahate = 2;
				// 			est[i].wancheng = false;

				// 		}
				// 		that.subarrid = est;
				// 		that.datacount = est.length;
				// 		console.log(est);
				// 		that.subjectarr(est[0].tid)

				// 		uni.hideLoading();

				// 		//记录
				// 		that.hege = hege;
				// 		//that.shijian = shijian;
				// 		//that.countdown = shijian+":00"
				// 		if (that.lang == 'cn') {
				// 			that.m = shijian;
				// 			that.wahte = shijian;
				// 		} else {
				// 			that.m = kzshijian;
				// 			that.wahte = kzshijian;
				// 		}

				// 		that.dannumber = dannumber;
				// 		that.duonumber = duonumber;
				// 		that.pannumber = pannumber;

				// 	},
				// 	fail(err) {
				// 		console.log(err);
				// 		uni.hideLoading();
				// 	}
				// });
			},
			miniarr(index) {
				var that = this;
				that.timg = '';
				that.dbjawap = '';
				that.subarr = {};
				console.log("iiiinnnnddeeeexxxx", index, that.subarrid);
				var minidata = that.subarrid[index];
				let arrjson = that.subarrid[index];
				that.subarr = that.subarrid[index];
				console.log('minidata=', minidata);
				that.tiimg = yunurl + minidata.timg;
				console.log('yunurl+minidata.timg', yunurl + minidata.timg);

				if (arrjson.collect == 1) {
					that.star = 1;
				} else {
					that.star = 0;
				}
				//判断是否选择过了
				setTimeout(function() {
					that.flag = 0; //防止再次滑动
				}, 50);
				//看看 用户答案
				console.log("that.subarrid[that.viewsindex].userjawap--===", that.subarrid[that.viewsindex].userjawap);
				var arrjsonuseranswer = that.subarrid[that.viewsindex].userjawap;
				if (arrjsonuseranswer !== null && arrjsonuseranswer !== '') {
					//已经选择过了
					console.log("已经选择过了")
					if (arrjson.ttype == 1) {
						that.jawap[0] = '';
						that.jawap[1] = '';
						that.jawap[2] = '';
						that.jawap[3] = '';
						that.worngly = false;
						that.dbjawap = '';
						var jawap = arrjsonuseranswer;
						if (arrjson.answer == jawap) {
							//答案正确 ,
							if (jawap == 'A') {
								that.jawap[0] = 'anschack';
							} else if (jawap == 'B') {
								that.jawap[1] = 'anschack';
							} else if (jawap == 'C') {
								that.jawap[2] = 'anschack';
							} else {
								that.jawap[3] = 'anschack';
							}
						} else {
							//打错了！
							if (jawap == 'A') {
								that.jawap[0] = 'wrong';
							} else if (jawap == 'B') {
								that.jawap[1] = 'wrong';
							} else if (jawap == 'C') {
								that.jawap[2] = 'wrong';
							} else {
								that.jawap[3] = 'wrong';
							}
							//正确答案是
							if (arrjson.answer == 'A') {
								that.jawap[0] = 'anschack 1';
							} else if (arrjson.answer == 'B') {
								that.jawap[1] = 'anschack 1';
							} else if (arrjson.answer == 'C') {
								that.jawap[2] = 'anschack 1';
							} else {
								that.jawap[3] = 'anschack 1';
							}

							//that.jawap = 'wrong';
							//进行收藏
						}
						that.dbjawap = arrjson.answer;
					}
					if (arrjson.ttype == 0) {
						that.jawapjudge[0] = '';
						that.jawapjudge[1] = '';
						that.worngly = false;
						that.dbjawap = '';
						var jawap = arrjsonuseranswer;
						if (arrjson.answer == jawap) {
							//答案正确 ,
							if (jawap == '对') {
								that.jawapjudge[0] = 'anschack';
							} else {
								that.jawapjudge[1] = 'anschack';
							}
						} else {
							//打错了！
							if (jawap == '对') {
								that.jawapjudge[0] = 'wrong';
							} else {
								that.jawapjudge[1] = 'wrong';
							}
							//正确答案是
							if (arrjson.answer == '对') {
								that.jawapjudge[0] = 'anschack 1';
							} else {
								that.jawapjudge[1] = 'anschack 1';
							}
						}
						that.dbjawap = arrjson.answer;
					}
					if (arrjson.ttype == 2) {
						console.log('duo xuan ti jinru pand');
						that.jawap[0] = '';
						that.jawap[1] = '';
						that.jawap[2] = '';
						that.jawap[3] = '';
						that.answers = [];
						that.worngly = false;
						that.dbjawap = '';
						var jawap = arrjsonuseranswer;
						var jawapjson = jawap.split(',');
						var jawaparrdb = arrjson.answer;

						//答案正确 ,
						let sane = 3;
						if (arrjson.option4 == '') {
							sane = 2;
						}

						if (jawaparrdb.indexOf('A') !== -1) {
							that.jawap[0] = 'anschack 1';
						}
						if (jawaparrdb.indexOf('B') !== -1) {
							that.jawap[1] = 'anschack 1';
						}
						if (jawaparrdb.indexOf('C') !== -1) {
							that.jawap[2] = 'anschack 1';
						}
						if (sane == 3) {
							if (jawaparrdb.indexOf('D') !== -1) {
								that.jawap[3] = 'anschack 1';
							}
						}
						let ashane = getArrEqual(jawaparrdb, jawapjson);
						console.log('(((((())))))', ashane);
						let arrload = getArrload(jawaparrdb, jawapjson);
						console.log('=======', arrload);
						console.log(jawaparrdb, jawapjson);
						if (arrload.length == 0) {
							console.log('全部正确');
						} else {
							console.log('部分正确');

							for (var i = 0; i < sane; i++) {
								if (jawapjson[i] == jawaparrdb[i]) {
									that.jawap[i] = 'anschack 1';
								} else {
									that.jawap[i] = 'wrong';
								}
							}
							for (var t = 0; t < jawapjson.length; t++) {
								if (jawaparrdb.indexOf(jawapjson[t]) == -1) {
									if (jawapjson[t] == 'A') {
										that.jawap[0] = 'wrong';
									}
									if (jawapjson[t] == 'B') {
										that.jawap[1] = 'wrong';
									}
									if (jawapjson[t] == 'C') {
										that.jawap[2] = 'wrong';
									}
									if (jawapjson[t] == 'D') {
										that.jawap[3] = 'wrong';
									}
								}
							}
						}

						//选择正确的
						if (ashane.indexOf('A') !== -1) {
							that.jawap[0] = 'anschack';
						}
						if (ashane.indexOf('B') !== -1) {
							that.jawap[1] = 'anschack';
						}
						if (ashane.indexOf('C') !== -1) {
							that.jawap[2] = 'anschack';
						}
						if (sane == 3) {
							if (ashane.indexOf('D') !== -1) {
								that.jawap[3] = 'anschack';
							}
						}
						//没有选择的
						if (arrload.indexOf('A') !== -1) {
							that.jawap[0] = 'anschack 1';
						}
						if (arrload.indexOf('B') !== -1) {
							that.jawap[1] = 'anschack 1';
						}
						if (arrload.indexOf('C') !== -1) {
							that.jawap[2] = 'anschack 1';
						}
						if (sane == 3) {
							if (arrload.indexOf('D') !== -1) {
								that.jawap[3] = 'anschack 1';
							}
						}

						console.log(that.jawap);

						that.dbjawap = arrjson.answer;
					}
				} else {
					//还没选择过
					console.log("还没选择过")
					that.jawap[0] = '';
					that.jawap[1] = '';
					that.jawap[2] = '';
					that.jawap[3] = '';
					that.answers = [];
					that.jawapjudge[0] = '';
					that.jawapjudge[1] = '';
					that.worngly = false;
					that.dbjawap = null;
				}

				that.subarr = arrjson;

				console.log(arrjson);

				console.log("that.dbjawap,that.jawap", "jawapjudge", "/////////", that.dbjawap, "--------", that.jawap,
					"*****************", that.jawapjudge)

			},
			dbid(indexdata) {
				var that = this;
				if (that.lolang == 'CN') {
					that.year = "2023"
				}
				var exampleList = {
					duoxuan: [],
					danxuan: [],
					panduan: []
				};
				var xart = ' kemu=' + that.kemu + " and ktype='" + that.subject + "' and year = '" + that.year +
					"' and tlang = '" + that.lolang + "'";

				var dansane = 0; //单选题数量
				var pansane = 0; //判断题数量
				var duosane = 0; //多选题数量
				var hege = 0; //合格 多少分合格
				var shijian = 0; //考试时间
				var kzshijian = 0;
				var dannumber = 0; //单选题 一道题多少分
				var duonumber = 0; //多选题 一道题多少分
				var pannumber = 0; //判断题 一道题多少分
				//车类型来判断  cart_type
				if (that.subject == 'C1C2C3' || that.subject == 'A2B2' || that.subject == 'A1A3B1') {
					if (that.kemu == 1) {
						dansane = 60; //单选题数量
						pansane = 40; //判断题数量
						duosane = 0; //多选题数量
						shijian = 45;
						kzshijian = 60;
						dannumber = 1;
						duonumber = 1;
						pannumber = 1;
					} else if (that.kemu == 4) {
						dansane = 20; //单选题数量
						pansane = 20; //判断题数量
						duosane = 10; //多选题数量
						shijian = 45;
						kzshijian = 60;
						dannumber = 2;
						duonumber = 2;
						pannumber = 2;
					}
				} else if (that.subject == 'DEF') {
					dansane = 30; //单选题数量
					pansane = 20; //判断题数量
					duosane = 0; //多选题数量
					hege = 80;
					shijian = 45;
					kzshijian = 60;
					dannumber = 2;
					duonumber = 2;
					pannumber = 2;
				} else if (that.subject == 'Z_KEYUN') {
					dansane = 40; //单选题数量
					pansane = 40; //判断题数量
					duosane = 10; //多选题数量
					hege = 80;
					shijian = 60;
					kzshijian = 90;
					dannumber = 1;
					duonumber = 2;
					pannumber = 1;
				} else if (that.subject == 'Z_HUOYUN') {
					dansane = 20; //单选题数量
					pansane = 20; //判断题数量
					duosane = 30; //多选题数量
					hege = 80;
					shijian = 60;
					kzshijian = 90;
					dannumber = 1;
					duonumber = 2;
					pannumber = 1;
				} else if (that.subject == 'Z_WEIXIANPING') {
					dansane = 50; //单选题数量
					pansane = 50; //判断题数量
					duosane = 0; //多选题数量
					hege = 90;
					shijian = 90;
					kzshijian = 90;
					dannumber = 1;
					duonumber = 0;
					pannumber = 1;
				}

				var dansql = 'SELECT tid FROM Tiku WHERE ttype = 1  and ' + xart + ' order by random() limit ' + dansane +
					'';
				var pansql = 'SELECT tid FROM Tiku WHERE ttype = 0  and ' + xart + ' order by random() limit ' + pansane +
					'';
				var duosql = 'SELECT tid FROM Tiku WHERE ttype = 2  and ' + xart + ' order by random() limit ' + duosane +
					'';
				var sql = 'SELECT answer, tid  FROM Tiku  WHERE tid IN (' + dansql + ') or tid IN (' + pansql +
					') or tid IN (' + duosql + ') order by ttype asc';
				// var danxuan = "";
				// var panduan = "";
				// var duoxuan = "";
				plus.sqlite.selectSql({
					name: 'data',
					sql: sql,
					success(est) {
						console.log('sssssssssssssss', est.length);
						console.log(sql);
						for (var i = 0; i < est.length; i++) {
							//console.log(i,est[i].tid);
							est[i].userjawap = null;
							est[i].twrahate = 2;
							est[i].wancheng = false;
						}
						that.subarrid = est;
						that.datacount = est.length;
						console.log(est);
						setTimeout(function() {
							that.subjectarr(est[0].tid);
						}, 300)


						uni.hideLoading();

						//记录
						that.hege = hege;
						//that.shijian = shijian;
						//that.countdown = shijian+":00"
						if (that.lang == 'cn') {
							that.m = shijian;
							that.wahte = shijian;
						} else {
							that.m = kzshijian;
							that.wahte = kzshijian;
						}

						that.dannumber = dannumber;
						that.duonumber = duonumber;
						that.pannumber = pannumber;
					},
					fail(err) {
						console.log(err);
						uni.hideLoading();
					}
				});
			},

			subjectarr(tid) {
				var that = this;
				if (that.lolang == 'CN') {
					that.year = "2023"
				}
			}
			var sql = 'select * from Tiku where kemu=' + that.kemu + " and  ktype='" + that.subject +
				"' and year = '" + that.year +
				"' and tlang = '" + that.lolang + "' and tid = " + tid + ' ';
			plus.sqlite.selectSql({
				name: 'data',
				sql: sql,
				success(e) {
					console.log(sql);
					console.log(e.length);
					if (e.length == 0) {
						console.log('全部已经看完了！');
					} else {
						//that.subarr = e;
						that.smalljson(e);
					}
					//console.log(e.length)
				},
				fail(e) {
					console.log(e);
				}
			});
		},
		smalljson(jso) {
			//简单方法封装
			var that = this;
			let strs = this.newtools.fun2();
			//console.log(this.newtools.fun1(strs));
			let jsonstr = this.newtools.fun1(strs);
			
			let arrjson = jso[0];
			let chapter = arrjson.chapter;
			let chapters = chapter;
			arrjson.chapter = chapters;
			
			let option1 = arrjson.option1;
			let option1s = option1;
			arrjson.option1 = option1s;
			
			let option2 = arrjson.option2;
			let option2s = option2;
			arrjson.option2 = option2s;
			
			let option3 = arrjson.option3;
			let option3s = option3;
			arrjson.option3 = option3s;
			
			let option4 = arrjson.option4;
			let option4s = option4;
			arrjson.option4 = option4s;
			
			let question = arrjson.question;
			let questions = question;
			arrjson.question = questions;
			
			let tdesc = arrjson.tdesc;
			let tdescs = tdesc;
			arrjson.tdesc = tdescs;
			if (arrjson.collect == 1) {
				that.star = 1;
			} else {
				that.star = 0;
			}
			that.tiimg = '';
			that.subarr = {};
			//判断是否有图片
			// console.log(arrjson.timg.length);
			if (arrjson.timg != null && arrjson.timg.length > 0) {
				// var imgname = getimgname(arrjson.timg) + '.json';
				var imgname = arrjson.timg;
				console.log('imgname', imgname);
				var filePath = '_doc/tjson/' + imgname;
				//先判断 static文件夹中是否存在
				var wwwpath = '_www/static/tjson/' + imgname;
				var dovpath = '_doc/tjson/' + imgname;

				plus.io.resolveLocalFileSystemURL(
					wwwpath,
					function(entry) {
						//如果www中找到
						plus.io.requestFileSystem(plus.io.PRIVATE_WWW, function(fs) {
							// fs.root是根目录操作对象DirectoryEntry
							fs.root.getFile(
								'static/tjson/' + imgname, {
									create: true
								},
								function(fileEntry) {
									let base;
									fileEntry.file(function(file) {
										var fileReader = new plus.io.FileReader();
										console.log('getFile:' + JSON.stringify(file));
										fileReader.readAsText(file, 'utf-8');

										fileReader.onloadend = function(evt) {
											console.log('11' + evt);
											console.log('evt.target' + evt.target);

											if (base == 'undefined') {
												that.tiimg = '';
											} else {
												//var macstr = base.replaceAll('\r\n', '');
												//console.log(macstr);
												//console.log(evt.target.result);

												that.tiimg = base;
											}

											// arrjson.timg = base;
										};
										fileReader.onprogress = function(e) {
											console.log('onprogress ---> ', e);
										};

										fileReader.onload = function(evt) {
											console.log('on load sss');
											//console.log()
											var imgstr = evt.target.result;
											//console.log(imgstr);
											//var imgbase = imgstr.split('######');
											//let s = that.AES.decrypt(imgbase[0], '1jhtconstrj2age3', '_tongyongjiakao_');
											//解密值
											//console.log(s);

											//var johnr = imgbase[1].replaceAll('\r\n', '');
											//base = s + imgbase[1];
											base = imgstr;
											//console.log(base)
											//var imgend = johnr;
											that.tiimg = base;
											//console.log({'tt':imgend},base)
										};
										console.log(file.size + '--' + file.name);
										fileReader.start();
										//console.log(base);
									});
								}
							);
						});
					},
					function(e) {
						//如果www中没有找到
						plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
							// fs.root是根目录操作对象DirectoryEntry
							fs.root.getFile(
								'tjson/' + imgname, {
									create: true
								},
								function(fileEntry) {
									let base;
									fileEntry.file(function(file) {
										var fileReader = new plus.io.FileReader();
										console.log('getFile:' + JSON.stringify(file));
										fileReader.readAsText(file, 'utf-8');

										fileReader.onloadend = function(evt) {
											console.log('11' + evt);
											console.log('evt.target' + evt.target);

											if (base == 'undefined') {
												that.tiimg = '';
											} else {

												that.tiimg = base;
											}

											// arrjson.timg = base;
										};
										fileReader.onprogress = function(e) {
											console.log('onprogress ---> ', e);
										};

										fileReader.onload = function(evt) {
											console.log('on load sss');
											var imgstr = evt.target.result;

											base = imgstr;

											that.tiimg = base;

										};
										console.log(file.size + '--' + file.name);
										fileReader.start();

									});
								}
							);
						});
					}
				);
				//判断完成了
				//老方法
				// plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
				//新方法
			}
			//判断是否选择过了
			setTimeout(function() {
				that.flag = 0; //防止再次滑动
			}, 50);

			//看看 用户答案
			console.log(that.subarrid[that.viewsindex].userjawap);
			var arrjsonuseranswer = that.subarrid[that.viewsindex].userjawap;
			if (arrjsonuseranswer !== null && arrjsonuseranswer !== '') {
				//已经选择过了
				if (arrjson.ttype == 1) {
					that.jawap[0] = '';
					that.jawap[1] = '';
					that.jawap[2] = '';
					that.jawap[3] = '';
					that.worngly = false;
					that.dbjawap = '';
					var jawap = arrjsonuseranswer;
					if (arrjson.answer == jawap) {
						//答案正确 ,
						if (jawap == 'A') {
							that.jawap[0] = 'anschack';
						} else if (jawap == 'B') {
							that.jawap[1] = 'anschack';
						} else if (jawap == 'C') {
							that.jawap[2] = 'anschack';
						} else {
							that.jawap[3] = 'anschack';
						}
					} else {
						//打错了！
						if (jawap == 'A') {
							that.jawap[0] = 'wrong';
						} else if (jawap == 'B') {
							that.jawap[1] = 'wrong';
						} else if (jawap == 'C') {
							that.jawap[2] = 'wrong';
						} else {
							that.jawap[3] = 'wrong';
						}
						//正确答案是
						if (arrjson.answer == 'A') {
							that.jawap[0] = 'anschack 1';
						} else if (arrjson.answer == 'B') {
							that.jawap[1] = 'anschack 1';
						} else if (arrjson.answer == 'C') {
							that.jawap[2] = 'anschack 1';
						} else {
							that.jawap[3] = 'anschack 1';
						}

						//that.jawap = 'wrong';
						//进行收藏
					}
					that.dbjawap = arrjson.answer;
				}
				if (arrjson.ttype == 0) {
					that.jawapjudge[0] = '';
					that.jawapjudge[1] = '';
					that.worngly = false;
					that.dbjawap = '';
					var jawap = arrjsonuseranswer;
					if (arrjson.answer == jawap) {
						//答案正确 ,
						if (jawap == '对') {
							that.jawapjudge[0] = 'anschack';
						} else {
							that.jawapjudge[1] = 'anschack';
						}
					} else {
						//打错了！
						if (jawap == '对') {
							that.jawapjudge[0] = 'wrong';
						} else {
							that.jawapjudge[1] = 'wrong';
						}
						//正确答案是
						if (arrjson.answer == '对') {
							that.jawapjudge[0] = 'anschack 1';
						} else {
							that.jawapjudge[1] = 'anschack 1';
						}
					}
					that.dbjawap = arrjson.answer;
				}
				if (arrjson.ttype == 2) {
					console.log('duo xuan ti jinru pand');
					that.jawap[0] = '';
					that.jawap[1] = '';
					that.jawap[2] = '';
					that.jawap[3] = '';
					that.answers = [];
					that.worngly = false;
					that.dbjawap = '';
					var jawap = arrjsonuseranswer;
					var jawapjson = jawap.split(',');
					var jawaparrdb = arrjson.answer;

					//答案正确 ,
					let sane = 3;
					if (arrjson.option4 == '') {
						sane = 2;
					}

					if (jawaparrdb.indexOf('A') !== -1) {
						that.jawap[0] = 'anschack 1';
					}
					if (jawaparrdb.indexOf('B') !== -1) {
						that.jawap[1] = 'anschack 1';
					}
					if (jawaparrdb.indexOf('C') !== -1) {
						that.jawap[2] = 'anschack 1';
					}
					if (sane == 3) {
						if (jawaparrdb.indexOf('D') !== -1) {
							that.jawap[3] = 'anschack 1';
						}
					}
					let ashane = getArrEqual(jawaparrdb, jawapjson);
					console.log('(((((())))))', ashane);
					let arrload = getArrload(jawaparrdb, jawapjson);
					console.log('=======', arrload);
					console.log(jawaparrdb, jawapjson);
					if (arrload.length == 0) {
						console.log('全部正确');
					} else {
						console.log('部分正确');

						for (var i = 0; i < sane; i++) {
							if (jawapjson[i] == jawaparrdb[i]) {
								that.jawap[i] = 'anschack 1';
							} else {
								that.jawap[i] = 'wrong';
							}
						}
						for (var t = 0; t < jawapjson.length; t++) {
							if (jawaparrdb.indexOf(jawapjson[t]) == -1) {
								if (jawapjson[t] == 'A') {
									that.jawap[0] = 'wrong';
								}
								if (jawapjson[t] == 'B') {
									that.jawap[1] = 'wrong';
								}
								if (jawapjson[t] == 'C') {
									that.jawap[2] = 'wrong';
								}
								if (jawapjson[t] == 'D') {
									that.jawap[3] = 'wrong';
								}
							}
						}
					}

					//选择正确的
					if (ashane.indexOf('A') !== -1) {
						that.jawap[0] = 'anschack';
					}
					if (ashane.indexOf('B') !== -1) {
						that.jawap[1] = 'anschack';
					}
					if (ashane.indexOf('C') !== -1) {
						that.jawap[2] = 'anschack';
					}
					if (sane == 3) {
						if (ashane.indexOf('D') !== -1) {
							that.jawap[3] = 'anschack';
						}
					}
					//没有选择的
					if (arrload.indexOf('A') !== -1) {
						that.jawap[0] = 'anschack 1';
					}
					if (arrload.indexOf('B') !== -1) {
						that.jawap[1] = 'anschack 1';
					}
					if (arrload.indexOf('C') !== -1) {
						that.jawap[2] = 'anschack 1';
					}
					if (sane == 3) {
						if (arrload.indexOf('D') !== -1) {
							that.jawap[3] = 'anschack 1';
						}
					}

					console.log(that.jawap);

					that.dbjawap = arrjson.answer;
				}
			} else {
				//还没选择过
				that.jawap[0] = '';
				that.jawap[1] = '';
				that.jawap[2] = '';
				that.jawap[3] = '';
				that.answers = [];
				that.jawapjudge[0] = '';
				that.jawapjudge[1] = '';
				that.worngly = false;
				that.dbjawap = '';
			}

			that.subarr = arrjson;
			console.log(arrjson);
		},

		onimgerr() {
			var that = this;
			that.subarr.timg = '';
		},
		settings: function() {
			console.log(this.show);
			if (this.show) {
				this.show = false;
			} else {
				this.show = true;
			}
		},
		sliderChange(e) {
			//设置字体大小
			console.log('value 发生变化：' + e.detail.value);
			var that = this;
			that.fontSize = e.detail.value;
			//保存字体大小
			uni.setStorage({
				key: 'fontsize',
				data: e.detail.value,
				success: function() {
					console.log('success');
				}
			});
		},
		musicbar(e) {
			console.log('chufa = ', e);
			var that = this;
			that.musicchecked = e;
			//保存提示音
			uni.setStorage({
				key: 'musicbars',
				data: e,
				success: function() {
					console.log('success');
				}
			});
		},
		vibrate(e) {
			var that = this;
			that.zhenchecked = e;
			//保存提示音
			uni.setStorage({
				key: 'vibratebars',
				data: e,
				success: function() {
					console.log('success');
				}
			});
		},
		marknext(e) {
			var that = this;
			that.nextchecked = e;
			//zhenchecked
			//保存自动跳转下一题
			uni.setStorage({
				key: 'nextbars',
				data: e,
				success: function() {
					console.log('success');
				}
			});
		},
		colour: function(num) {
			console.log(num);
			var that = this;
			var colors;
			if (num == 0) {
				that.colorStyle = true;
				colors = true;
				that.titlecolor = '#888888';
			} else {
				that.colorStyle = false;
				colors = false;
				that.titlecolor = '#2d2d2d';
			}
			uni.setStorage({
				key: 'colorStyle',
				data: colors,
				success: function() {
					console.log('success');
					that.titlebgcolor(colors);
				}
			});
		},
		titlebgcolor(bgcolors) {
			var that = this;
			if (bgcolors == true) {
				that.background.backgroundColor = '#2d2d2d';
				that.titlecolor = '#888888';
			} else {
				that.background.backgroundColor = '#ffffff';
				that.titlecolor = '#2d2d2d';
			}
		},
		timeCount() {
			--this.s;

			if (this.s < 0) {
				--this.m;

				this.s = 59;
			}

			if (this.m < 0) {
				--this.h;

				this.m = 59;
			}
			var sectext = this.s;
			if (this.s < 10) {
				sectext = '0' + this.s;
			} else {
				sectext = this.s;
			}

			this.countdown = this.m + ':' + sectext;
			if (this.m == 0 && this.s == 0) {
				console.log('时间到');
				var that = this;
				that.timeout = true;
				var tisane = that.subarrid.length;
				var jalpenumbers = that.jalpenum;
				var hegenum = that.hege;
				//考试结束
				that.shownum = true;
				if (jalpenumbers > hegenum) {
					//考试通过了！ 跳转到考试合格页面
					that.hegetrue = true;
				} else {
					that.hegetrue = false;
				}
				clearInterval(this.timer);
			}
		},

		jiaojuant() {
			//交卷提示
			var that = this;
			that.shownum = true;
			clearInterval(this.timer);
		},
		jiaojuan() {
			//交卷
			var that = this;
			//记录最总的成绩
			console.log(that.wahte, that.m, that.s);
			var mino = that.wahte - 1;
			var wahete = mino - that.m;
			var wahtminowt = 59 - that.s;
			var estelek;
			if (wahete == 0) {
				estelek = wahtminowt;
			} else {
				estelek = wahete + "'" + wahtminowt;
			}
			if (that.jalpenum !== 0) {
				// #ifdef APP-PLUS
				addTabItem('data', 'record', {
					recordnum: that.jalpenum,
					adddate: new Date().getTime(),
					subject: that.subject,
					timeuse: estelek,
					tlang: that.lolang,
					kemu: that.kemu
				}).then(res => {
					console.log(res);
					uni.reLaunch({
						url: './record?kemu=' + that.kemu + '&cartype=' + that.cartype + '&subject=' +
							that.subject + '&natije=' + that.jalpenum + '&hegetrue=' + that.hegetrue
					});
				});
				// #endif
				// #ifdef MP-WEIXIN
				uni.getStorage({
					key: that.subject + '_examlist_' + that.lang + '_' + that.kemu,
					success: function(res) {
						console.log(res.data);
						var examlists = [{
							recordnum: that.jalpenum,
							adddate: new Date().getTime(),
							subject: that.subject,
							timeuse: estelek,
							tlang: that.lolang,
							kemu: that.kemu
						}];
						var exlist = res.data;
						var newlists = examlists.concat(exlist);
						uni.setStorage({
							key: that.subject + '_examlist_' + that.lang + '_' + that.kemu,
							data: newlists,
							success: function() {
								uni.reLaunch({
									url: './record?kemu=' +
										that.kemu +
										'&cartype=' +
										that.cartype +
										'&subject=' +
										that.subject +
										'&natije=' +
										that.jalpenum +
										'&hegetrue=' +
										that.hegetrue
								});
							}
						});
					},
					fail(e) {
						console.log('index key no', e);
						//没有任何记录
						var examlists = [{
							recordnum: that.jalpenum,
							adddate: new Date().getTime(),
							subject: that.subject,
							timeuse: estelek,
							tlang: that.lolang,
							kemu: that.kemu
						}];
						uni.setStorage({
							key: that.subject + '_examlist_' + that.lang + '_' + that.kemu,
							data: examlists,
							success: function() {
								uni.reLaunch({
									url: './record?kemu=' +
										that.kemu +
										'&cartype=' +
										that.cartype +
										'&subject=' +
										that.subject +
										'&natije=' +
										that.jalpenum +
										'&hegetrue=' +
										that.hegetrue
								});
							}
						});
					}
				});
				// #endif
			} else {
				uni.reLaunch({
					url: './record?kemu=' + that.kemu + '&cartype=' + that.cartype + '&subject=' + that
						.subject + '&natije=' + that.jalpenum + '&hegetrue=' + that.hegetrue
				});
			}
		},
		jixu() {
			// 继续
			var that = this;
			if (that.timeout == true) {
				//时间已到
				uni.showToast({
					title: '时间已到',
					duration: 2000
				});
			} else {
				//时间还没到 可以继续做题
				that.shownum = false;
			}
			that.showqiut = false;
			that.timerstart();
		},
		handletouchstart: function(event) {
			// this.lastX = event.changedTouches[0].pageX;
			this.lastXX = event.changedTouches[0].pageX;

			// this.startData.clientX = e.changedTouches[0].clientX;   //手指按下时的X坐标
			// this.startData.clientY = e.changedTouches[0].clientY;   //手指按下时的Y坐标
		},
		handletouchend: function(event) {
			var that = this;
			//停止滑动
			console.log('2222222222222222222222222222');
			console.log(event.changedTouches[0].pageX);
			console.log(this.lastXX, this.lastX, event.changedTouches[0].pageX);
			console.log('xxxx=', Math.abs(this.lastXX - event.changedTouches[0].pageX));
			console.log(this.flag);
			if (Math.abs(this.lastXX - event.changedTouches[0].pageX) > 80) {
				//在事件结束时，判断滑动的距离是否达到出发需要执行事件的要求
				console.log('执行查看跳转事件');
				if (this.flag !== 0) {
					return;
				}
				if (this.lastXX - this.lastX > 0) {
					console.log('向左滑动');
					this.flag = 1;
					that.nextt(1);
				} else {
					console.log('向右滑动');
					this.flag = 2;
					that.privet(1);
				}
			} else {
				console.log('滑动距离不够，不执行跳转');
			}
		},
		handletouchmove: function(event) {
			//console.log(event)
			if (this.flag !== 0) {
				return;
			}
			setTimeout(function() {
				this.flag = 0;
			}, 50);

			let currentX = event.changedTouches[0].pageX;
			let currentY = event.changedTouches[0].pageY;
			let tx = currentX - this.lastX;
			let ty = currentY - this.lastY;

			var that = this;
			var txnum = 0;
			//console.log('1111111111111111111111');
			//左右方向滑动
			// if (Math.abs(tx) > Math.abs(ty)) {

			// 	if (tx < 0) {
			// 		// 向左滑动
			// 		this.flag = 1;

			// 	} else if (tx > 0) {
			// 		//向右滑动
			// 		this.flag = 2;

			// 	}
			// }
			console.log(this.flag);
			//上下方向滑动
			// else {
			//     if (ty < 0) {
			//         //向上滑动
			//         this.flag = 3;
			//     } else if (ty > 0) {
			//         //向下滑动
			//         this.flag = 4;
			//     }
			// }

			//将当前坐标进行保存以进行下一次计算
			this.lastX = currentX;
			this.lastY = currentY;
		},
		nextt(nus) {
			var that = this;

			var index = that.viewsindex + 1;
			if (index === that.datacount) {
				console.log('全部已看完');
				this.flag = 0;
				uni.showToast({
					title: '已经最后一道题',
					duration: 2000
				});

				return false;
			}
			console.log('inde99999999----', index);
			console.log("that.subarrid++++++", that.subarrid);
			that.dbjawap = "";
			var tid = that.subarrid[index].tid;
			console.log('tid--=*******==' + tid);

			//that.tanru();

			//setTimeout(function() {
			that.viewsindex = index;
			that.tiimg = '';
			that.subarr = {};

			// #ifdef APP-PLUS
			that.subjectarr(tid);
			// #endif
			// #ifdef MP-WEIXIN
			that.miniarr(index);
			// #endif
			//}, 50)

			//}, 50)

		},

		privet(nus) {
			var that = this;

			if (that.viewsindex === 0) {
				console.log('第一题');
				this.flag = 0;
				uni.showToast({
					title: '这是第一道题',
					duration: 2000
				});

				return false;
			}



			var index = that.viewsindex - 1;
			that.dbjawap = "";
			//that.tiimg = '../../static/logo.png';
			var tid = that.subarrid[index].tid;
			//that.tanchu();


			that.viewsindex = index;
			that.subarr = {};
			that.tiimg = '';
			// #ifdef APP-PLUS
			that.subjectarr(tid);
			// #endif
			// #ifdef MP-WEIXIN
			that.miniarr(index);
			// #endif


		}

	}
	};
	//https://ext.dcloud.net.cn/plugin?id=3456  单选多选使用
</script>

<style>
	page {
		height: 100%;
	}

	image {
		height: auto;
	}

	.cnlayout .topictype {
		margin-top: 10rpx;
	}

	.cnlayout .toppicplay {
		margin-top: 10rpx;
	}

	.cnmargint {
		margin-top: 20rpx;
	}

	.clearfloat {
		clear: both;
		height: 0;
		font-size: 1px;
		line-height: 0px;
	}

	.mheight {
		display: block;
		height: calc(100vh - 70px - 30rpx);
	}

	.csimg {
		vertical-align: middle;
		padding-top: 12rpx;
	}

	.colles {
		width: 40rpx;
		margin: 0rpx auto 0 auto;
	}

	.nodeheight {
		line-height: 200% !important;
	}

	.nodeheight div {
		line-height: 200% !important;
	}

	.nodeheight p {
		line-height: 200% !important;
	}

	.queding {
		width: 700rpx;
		padding: 20rpx 0rpx;
		margin: 0 auto;
	}

	.duoqueding {
		width: 500rpx;
		margin: 0 auto;
		background: #0bd34e;
		color: #ffffff;
	}

	.abdborder {
		border: 1rpx solid #0bd34e;
	}

	.timg {
		width: 600rpx;
		height: 325rpx;
		margin: 0 auto 20rpx auto;
		/* padding-bottom: 20rpx; */
	}

	.timg image {
		width: 600rpx;
		height: 305rpx;
		margin: 0 auto;
		padding: 20rpx 0rpx;
	}

	.kz .answerselect {
		margin-top: -9rpx;
	}

	.uy .answerselect {
		margin-top: -9rpx;
	}

	.grenntext {
		color: #0bd34e;
	}

	.txtalign {
		text-align: justify;
		vertical-align: top;
	}

	/* #ifdef MP-WEIXIN */
	.u-navbar-content-title {
		left: 80rpx !important;
	}

	/* #endif */
	.carttitle {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		width: 750rpx;
		height: 80rpx;
		background: #f8f8f8;
	}

	.carttitleview {
		width: 250rpx;
		display: inline-block;
	}

	.cartcon {
		width: 750rpx;
		height: 620rpx;
		overflow: hidden;
		position: relative;
	}

	.scroll-Y {
		height: 620rpx;
		overflow-y: scroll;
	}

	.kz .cartconnum {
		line-height: 95rpx;
	}

	.uy .cartconnum {
		line-height: 95rpx;
	}

	.cartconview {
		/* display: flex;
	flex-wrap:wrap; */
		flex-direction: row;
		align-items: center;
		text-align: center;
		height: 600rpx;
		overflow-y: scroll;
		justify-content: space-between;
		touch-action: none;
	}

	.cartconnum {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		text-align: center;
		line-height: 80rpx;
		display: inline-block;
		border: 1px solid #bbbbbb;
		margin: 15rpx;
	}

	.cartpink {
		background: #fed4d5;
		color: #db7d7b;
		border: none;
	}

	.cartblue {
		background: #bee3fe;
		color: #4f86af;
		border: none;
	}

	.cartaction {
		border: solid 1rpx #4f86af;
		color: #4f86af;
	}

	.pl-20 {
		padding-left: 20rpx;
	}

	.pl-10 {
		padding-left: 10rpx;
	}

	.pb50 {
		padding-bottom: 50rpx;
	}

	.black {
		background: #2d2d2d;
		height: 100%;
		display: block;
		overflow: hidden;
		overflow-y: auto;
		position: relative;
	}

	.black .answerabcd {
		background: #2d2d2d;
		box-shadow: 4px #e6e6e6;
	}

	.black .popup {
		color: #2d2d2d;
	}

	.white {
		background: #ffffff;
		height: 100%;
		display: block;
		overflow: hidden;
		overflow-y: auto;
		position: relative;
	}

	.white .answerabcd {
		background: #f3f4f6;
		box-shadow: 4px #e3e3e3;
	}

	.pt-10 {
		padding-top: 10rpx;
	}

	.marfoot {
		width: 750rpx;
		height: 130rpx;
		position: fixed;
		left: 0rpx;
		bottom: 0rpx;
	}

	.white .marfoot {
		background: #fefffd;
	}

	.black .marfoot {
		background: #20231d;
	}

	.markfoot {
		width: 750rpx;
		height: 130rpx;
		line-height: 130rpx;
		box-shadow: -5rpx 0px 5px #848584;
		position: fixed;
		left: 0rpx;
		bottom: 0rpx;
		/* padding-bottom: 50rpx; */
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
	}

	.white .markfoot {
		background: #fefffd;
	}

	.black .markfoot {
		background: #20231d;
	}

	.markfootview {
		display: inline-block;
	}

	.kongan {
		padding: 0rpx 30rpx;
		height: 60rpx;
		line-height: 60rpx;
		border-radius: 80rpx;
		border: 1rpx solid #ee1993;
		color: #ee1993;
	}

	.pl-15 {
		padding-left: 15rpx;
	}

	.pr-15 {
		padding-right: 15rpx;
	}

	.answercol {
		width: 700rpx;
		padding: 10rpx 0rpx;
		border-radius: 5rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		border-bottom: 1px solid rgba(0, 0, 0, 0.5);
		font-size: 32rpx;
	}

	.white .answercol {
		background: #f6f7f6;
	}

	.black .answercol {
		background: #20231d;
	}

	.answerow {
		width: 250rpx;
		display: inline-block;
	}

	.answerclear {
		width: 200rpx;
		display: inline-block;
	}

	.answermark {
		width: 700rpx;
		margin: 10rpx auto;
		padding-bottom: 130rpx;
	}

	.answermarktitle {
		width: 700rpx;
		padding: 5rpx 0rpx;
	}

	.answermarkcon {
		padding: 5rpx 0rpx;
		line-height: 150%;
	}

	.bluemark {
		color: #3185c4;
	}

	.pinkmark {
		color: #e81242;
	}

	.answer {
		margin: 25rpx 0;
	}

	.answers {
		display: flex;
		flex-direction: row;
		align-items: flex-start;
		justify-content: left;
		vertical-align: middle;
		padding: 25rpx 0rpx;
	}

	.kz .answers {
		justify-content: right;
	}

	.uy .answers {
		justify-content: right;
	}

	.answerselect {
		display: inline-block;
		align-items: flex-start;
	}

	.answerstext {
		display: inline-block;
		align-items: flex-start;
		padding-left: 10rpx;
		text-align: justify;
	}

	.kz .answerstext {
		padding-left: 0rpx !important;
		padding-right: 10rpx;
	}

	.uy .answerstext {
		padding-left: 0rpx !important;
		padding-right: 10rpx;
	}

	.answerabcd {
		border-radius: 50%;
		text-align: center;
		font-size: 35rpx;
		box-shadow: 3rpx 3rpx 3rpx #848584;
	}

	.anschack .answerabcd {
		background: #0bd34e;
		color: #ffffff;
	}

	.anschack .answerstext {
		color: #0bd34e;
	}

	.wrong .answerabcd {
		background: #ff0000;
		color: #ffffff;
	}

	.wrong .answerstext {
		color: #ff0000;
	}

	.topic {
		width: 700rpx;
		margin: 0 auto;
		display: block;
		padding-top: 30rpx;
		position: relative;
	}

	.topiccon {
		display: block;
		padding: 2rpx 5rpx;
		text-align: justify !important;
	}

	.topictype {
		background: #1894f4;
		padding: 0rpx 10rpx;
		float: left;
	}

	.toppicplay {
		width: 40rpx;
		height: 40rpx;
		margin-left: 10rpx;
		margin-right: 15rpx;
		float: left;
	}

	.toppicplay image {
		width: 40rpx;
		height: 40rpx;
	}

	.topictext {
		padding: 2rpx 5rpx;
		float: left;
		display: block;
	}

	.kzlayout .topictype {
		float: right !important;
	}

	.kzlayout .toppicplay {
		float: right !important;
	}

	.uylayout .topictype {
		float: right !important;
	}

	.uylayout .toppicplay {
		float: right !important;
	}

	.clearfloat {
		clear: both;
		height: 0;
		font-size: 1px;
		line-height: 0px;
	}

	.kz .settingfootbu text {
		line-height: 70rpx !important;
		height: 60rpx !important;
	}

	.uy .settingfootbu text {
		line-height: 70rpx !important;
		height: 60rpx !important;
	}

	.poptitle {
		width: 750rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-indent: 30rpx;
	}

	.settingtitle {
		width: 700rpx;
		height: 80rpx;
		margin: 0 auto;
		border-bottom: solid 2rpx #dedfde;
	}

	.settingcon {
		width: 700rpx;
		margin: 0 auto;
		display: flex;
		justify-items: baseline;
	}

	.pt50 {
		padding-top: 50rpx;
	}

	.settingcontxt {
		width: 600rpx;
		height: 80rpx;
		display: inline-block;
	}

	.settingswith {
		width: 100rpx;
		height: 80rpx;
		display: inline-block;
	}

	.settingfoot {
		width: 700rpx;
		margin: 0 auto;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
	}

	.settingfoottext {
		justify-items: left;
		padding: 0 15rpx;
		height: 60rpx;
		line-height: 60rpx;
	}

	.settingfootbu {
		height: 60rpx;
		border-radius: 15rpx;
		line-height: 60rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: center;
	}

	.settingfootbu text {
		display: inline-block;
		line-height: 60rpx;
	}

	.settingfootbutext {
		display: inline-block;
		line-height: 60rpx;
	}

	.settingfootbu image {
		display: inline-block;
		width: 40rpx;
		height: 40rpx;
		justify-content: center;
	}

	.white {
		background: #fcfdfc;
		color: #3c3d3c;
	}

	.black {
		background: #2d2d2d;
		color: #888888;
	}

	.fontsizes {
		width: 750rpx;
		height: 80rpx;
		position: relative;
		display: flex;
		align-items: center;
		justify-items: baseline;
	}

	.fontsizeleft {
		width: 80rpx;
		height: 80rpx;
		display: inline-block;
		line-height: 80rpx;
		text-align: center;
	}

	.fontsizebg {
		width: 590rpx;
		height: 34rpx;

		display: inline-block;
		background: url(../../static/images/fontsize.png) no-repeat;
		background-size: 100% auto;
		justify-content: center;
		margin-top: 0rpx;
	}

	.fontslider {
		margin-top: -7rpx;
		width: 100%;
		margin-left: 0rpx;
	}

	.settingimg {
		width: 40rpx;
		height: 40rpx;
	}

	.wrap {
		padding: 24rpx;
	}

	.navbar-right {
		margin-right: 24rpx;
		display: flex;
		align-items: flex-end;
		right: 10rpx;
		position: absolute;
	}

	.slot-wrap {
		display: flex;
		align-items: center;
		flex: 1;
		position: relative;
	}

	.right-item {
		margin: 0 12rpx;
		position: relative;
		color: #ffffff;
		display: flex;
	}

	.message-box {
		width: 40rpx;
		height: 40rpx;
	}

	.flunkfoot {
		width: 600rpx;
		height: 100rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		flex-wrap: wrap;
		justify-content: space-between;
		position: absolute;
		bottom: 0;
		left: 0;
	}

	.flunkfootbutton {
		width: 50%;
		height: 100rpx;
		line-height: 100rpx;
	}

	.flunkview {
		width: 500rpx;
		height: 100rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		flex-wrap: wrap;
		justify-content: space-between;
		margin: 30rpx auto 0 auto;
	}

	.flunkviewrow {
		width: 30%;
		height: 100rpx;
		display: inline-block;
	}

	.flunkviewrowtxt {
		height: 50rpx;
		width: 100%;
		line-height: 50rpx;
		text-align: center;
	}

	.flunk {
		width: 600rpx;
		height: 800rpx;
		background: #ffffff;
		margin: 0 auto;
		border-radius: 30rpx;
		position: relative;
	}

	.flunkq {
		width: 600rpx;
		height: 700rpx;
		background: #ffffff;
		margin: 0 auto;
		border-radius: 30rpx;
		position: relative;
	}

	.flunktitle {
		width: 600rpx;
		height: 150rpx;
		text-align: center;
		line-height: 150rpx;
	}

	.kz .flunktitle {
		line-height: 170rpx;
	}

	.uy .flunktitle {
		line-height: 170rpx;
	}

	.flunkcon {
		border-radius: 50%;
		width: 350rpx;
		height: 350rpx;
		margin: 0 auto;
	}

	.redborder {
		border: 8rpx solid #e81242;
	}

	.greyborder {
		border: 8rpx solid #c1c2c1;
	}

	.flunkconview {
		width: 350rpx;
		height: 160rpx;
		margin: 120rpx auto;
	}

	.flunkconviewtext {
		width: 350rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
	}

	/* 新的动画效果 */

	/* 动画特效开始 */
	.tanchu {
		/* Chrome, Safari, Opera */
		-webkit-animation-name: moveit;
		-webkit-animation-duration: 0.5s;
		/* Standard syntax */
		animation-name: moveit;
		animation-duration: 0.5s;
		/* animation-name: in-left;
		animation-play-state: running;
		-webkit-animation-name: in-left;
		-webkit-animation-play-state: running; */
		box-shadow: 0 5px 5px 1px #999;
		height: 100%;
	}

	.tanchuz {
		/* Chrome, Safari, Opera */
		-webkit-animation-name: moveitz;
		-webkit-animation-duration: 0.5s;
		/* Standard syntax */
		animation-name: moveitz;
		animation-duration: 0.5s;
		/* animation-name: out-left;
		animation-play-state: running;
		-webkit-animation-name: out-left;
		-webkit-animation-play-state: running; */
		box-shadow: 0 5px 5px 1px #999;
		height: 100%;
	}

	/* Chrome, Safari, Opera */
	@-webkit-keyframes moveitz {
		from {
			left: 0;
		}

		to {
			left: -150%;
			opacity: 0;
		}
	}

	/* Standard syntax */
	@keyframes moveitz {
		from {
			left: 0;
		}

		to {
			left: -150%;
			opacity: 0;
		}
	}

	/* Chrome, Safari, Opera */
	@-webkit-keyframes moveit {
		from {
			left: 0;
		}

		to {
			left: 150%;
			opacity: 0;
		}
	}

	/* Standard syntax */
	@keyframes moveit {
		from {
			left: 0;
		}

		to {
			left: 150%;
			opacity: 0;
		}
	}

	/* 动画特效结束 */
	/* 隐形显示id */
	.viewid {
		color: #b3b3b3;
		font-size: 20rpx;
	}

	/* 隐形显示id结束 */
	.bos100 {
		width: 750rpx;
		height: 100rpx;
	}
</style>